<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="x-ua-compatible" content="ie=edge">

    <title>Far发现你热爱的电影和演员</title>

    <!-- Font Awesome Icons -->
    <link rel="stylesheet" href="/static/plugins/fontawesome-free/css/all.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/static/dist/css/adminlte.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
    <!-- overlayScrollbars -->
    <link rel="stylesheet" href="/static/dist/css/adminlte.min.css">
    <!-- Google Font: Source Sans Pro -->
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">

    <!-- Navbar -->
    <nav class="main-header navbar navbar-expand navbar-white navbar-light">
        <!-- Left navbar links -->
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
            </li>
            <li class="nav-item d-none d-sm-inline-block">
                <a href="index3.html" class="nav-link">首页</a>
            </li>
            <li class="nav-item d-none d-sm-inline-block">
                <a href="#" class="nav-link">联系人</a>
            </li>
        </ul>

        <!-- Right navbar links -->
        <ul class="navbar-nav ml-auto">
            <li class="nav-item dropdown">
                <a class="nav-link" data-toggle="dropdown" href="">
                    <i class="far fa-user"></i>
                    <span class="badge badge-primary navbar-badge">2</span>
                </a>
                <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
                    <span class="dropdown-header">个人信息</span>
                    <div class="col-md-12">
                        <!-- Widget: user widget style 2 -->
                        <div class="card card-widget widget-user-2">
                            <!-- Add the bg color to the header using any of the bg-* classes -->
                            <div class="widget-user-header bg-warning">
                                <div class="widget-user-image">
                                    <img class="img-circle elevation-2" src="{{ Session.userimage }}" alt="User Avatar">
                                </div>
                                <!-- /.widget-user-image -->
                                <h3 class="widget-user-username">{{ session.username }}</h3>
                                <h5 class="widget-user-desc">{{ session.userdesc }}</h5>
                            </div>
                            <div class="card-footer p-0">
                                <ul class="nav flex-column">
                                    <li class="nav-item">
                                        <a class="nav-link">
                                            ID <span class="float-right badge bg-primary">{{ session.userid }}</span>
                                        </a>
                                    </li>
                                    <li class="nav-item">
                                        <a class="nav-link">
                                            性别 <span class="float-right badge bg-danger">{{ session.usergender }}</span>
                                        </a>
                                    </li>
                                    <li class="nav-item">
                                        <a class="nav-link">
                                            邮箱 <span class="float-right badge bg-info">{{ session.useremail }}</span>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <!-- /.widget-user -->
                    </div>
                    <div class="dropdown-divider"></div>
                    <a href="{{ url_for('account.logout') }}" class="dropdown-item dropdown-footer">退出登录</a>
                </div>
            </li>
        </ul>
    </nav>
    <!-- /.navbar -->

    <!-- Main Sidebar Container -->
    <aside class="main-sidebar sidebar-dark-primary elevation-4">
        <!-- Brand Logo -->
        <a href="{{ url_for('actor.start') }}" class="brand-link">
            <img src="/static/dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
                 style="opacity: .8">
            <span class="brand-text ">电影演员分析推荐</span>
        </a>

        <!-- Sidebar -->
        <div class="sidebar">
            <!-- Sidebar user panel (optional) -->
            <div class="user-panel mt-3 pb-3 mb-3 d-flex">
                <div class="image">
                    <img src="{{ Session.userimage }}" class="img-circle elevation-2" alt="User Image">
                </div>
                <div class="info">
                    <a href="#" class="d-block">{{ Session.username }}</a>
                </div>
            </div>

            <!-- Sidebar Menu -->
            <nav class="mt-2">
                <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu"
                    data-accordion="false">
                    <!-- Add icons to the links using the .nav-icon class
                         with font-awesome or any other icon font library -->
                    <li class="nav-item has-treeview menu-open">
                        <a class="nav-link active">
                            <i class="nav-icon fas fa-tachometer-alt"></i>
                            <p>
                                功能菜单
                                <i class="right fas fa-angle-left"></i>
                            </p>
                        </a>
                        <ul class="nav nav-treeview">
                            <li class="nav-item">
                                <a href="{{ url_for('actor.start') }}" class="nav-link active">
                                    <i class="far fa-circle nav-icon"></i>
                                    <p>演员列表</p>
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="{{ url_for('film.start') }}" class="nav-link">
                                    <i class="far fa-circle nav-icon"></i>
                                    <p>电影列表</p>
                                </a>
                            </li>
                        </ul>
                    </li>
                    <li class="nav-item">
                        <a href="{{ url_for('recommend.start') }}" class="nav-link">
                            <i class="nav-icon fas fa-th"></i>
                            <p>
                                演员推荐
                                <span class="right badge badge-danger">Hot</span>
                            </p>
                        </a>
                    </li>
                </ul>
            </nav>
            <!-- /.sidebar-menu -->
        </div>
        <!-- /.sidebar -->
    </aside>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <div class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1 class="m-0 text-dark">演员列表</h1>
                    </div><!-- /.col -->
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                            <li class="breadcrumb-item"><a href="#">首页</a></li>
                            <li class="breadcrumb-item active">演员列表</li>
                        </ol>
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.container-fluid -->
        </div>
        <!-- /.content-header -->

        <!-- Main content -->
        <div class="content">
            <div class="container-fluid">
                <!-- Default box -->
                <div class="input-group input-group-sm ">
                    <input id="searchContent" type="text" placeholder="搜索演员姓名..." aria-label="Search">
                    <div class="input-group-append">
                        <button class="btn btn-sm btn-primary" onclick="searchActor();">
                            <i class="fas fa-search">搜索</i>
                        </button>
                    </div>
                </div>
                <br>
                <div class="card card-solid">
                    <div class="card-body pb-0">
                        <div class="row d-flex align-items-stretch">
                            {% for actor in Actors %}
                                <div class="col-12 col-sm-6 col-md-4 d-flex align-items-stretch">
                                    <div class="card bg-light">
                                        <div class="card-header text-muted border-bottom-0">
                                            {{ actor.actor_c_name }}
                                        </div>
                                        <div class="card-body pt-0">
                                            <div class="row">
                                                <div class="col-7">
                                                    <h2 class="lead"><b>{{ actor.actor_c_name }}</b></h2>
                                                    <p class="text-muted text-sm"><b>职业: </b> {{ actor.actor_career }}
                                                    </p>
                                                    <ul class="ml-4 mb-0 fa-ul text-muted">
                                                        <li class="small"><span class="fa-li"><i
                                                                class="fas fa-lg fa-baby"></i></span> 出身日期
                                                            : {{ actor.actor_birthday }}</li>
                                                        <li class="small"><span class="fa-li"><i
                                                                class="fas fa-lg fa-building"></i></span> 出生城市
                                                            : {{ actor.actor_birthplace }}</li>
                                                        <li class="small"><span class="fa-li"><i
                                                                class="fas fa-lg fa-star"></i></span> 星座
                                                            : {{ actor.actor_horoscope }}</li>
                                                    </ul>
                                                </div>
                                                <div class="col-5 text-center">
                                                    <img src="/static/image/actor/{{ actor.actor_img }}" alt=""
                                                         class="img-circle img-fluid">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="card-footer">
                                            <div class="text-right">
                                                {% if actor.actor_id in Likes %}
                                                    <a id="likeButton{{ actor.actor_id }}" class="btn btn-sm bg-red"
                                                       onclick="likeActors(this);">
                                                        <i id="likeButton{{ actor.actor_id }}Color"
                                                           class="fas fa-heart"></i> 喜欢
                                                    </a>
                                                {% else %}
                                                    <a id="likeButton{{ actor.actor_id }}" class="btn btn-sm bg-teal"
                                                       onclick="likeActors(this);">
                                                        <i id="likeButton{{ actor.actor_id }}Color"
                                                           class="fas fa-heart-broken"></i> 喜欢
                                                    </a>
                                                {% endif %}
                                                <a id="moreButton{{ actor.actor_id }}" class="btn btn-sm btn-primary"
                                                   onclick="showMore(this);">
                                                    <i class="fas fa-user" style="color:white;font-size: small">查看更多</i>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            {% endfor %}
                        </div>
                    </div>
                    <!-- /.card-body -->

                    <div class="card-footer">
                        <nav aria-label="Contacts Page Navigation">
                            <ul class="pagination justify-content-center m-0">
                                <span>到底了（づ￣3￣）づ╭❤～</span>
                            </ul>
                        </nav>
                    </div>
                    <!-- /.card-footer -->
                </div>
                <!-- /.card -->
            </div><!-- /.container-fluid -->
        </div>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
        <!-- Control sidebar content goes here -->
        <div class="p-3">
            <h5>Title</h5>
            <p>Sidebar content</p>
        </div>
    </aside>
    <!-- /.control-sidebar -->

    <!-- Main Footer -->
    <footer class="main-footer">
        <!-- To the right -->
        <div class="float-right d-none d-sm-inline">
            Far 电影演员分析推荐系统
        </div>
        <!-- Default to the left -->
        <strong>Copyright <a href="https://github.com/HunterLC">HunterLC</a>.</strong> All rights reserved.
    </footer>
</div>
<!-- ./wrapper -->

<!-- REQUIRED SCRIPTS -->

<!-- jQuery -->
<script src="/static/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="/static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="/static/dist/js/adminlte.min.js"></script>
<script>
    function searchActor() {
        var searchContent = document.getElementById("searchContent").value;
        window.location.href = "{{ url_for('actor.start') }}" + "?actor_c_name=" + searchContent;
    }
</script>
<script>
    function showMore(self) {
        console.log(self.id);
        window.location.href = "{{ url_for('actor.get_actor_info') }}" + "?actor_id=" + self.id;
    }
</script>
<script>
    function likeActors(self) {
        jQuery.ajax({
            //几个参数需要注意一下
            type: "GET",//方法类型
            async: false,
            dataType: "json",//预期服务器返回的数据类型
            url: "{{ url_for('account.like_actors') }}" + "?actor_id=" + self.id,//url
            success: function (data) {
                if(data.type==='like'){
                    $('#'+self.id).attr('class','btn btn-sm bg-red');
                    $('#'+self.id+'Color').attr('class', 'fas fa-heart');
                }
                else if(data.type==='unlike'){
                    $('#'+self.id).attr('class','btn btn-sm bg-teal');
                    $('#'+self.id+'Color').attr('class', 'fas fa-heart-broken');
                }
            },
            error: function () {
                alert("异常！");
            }
        });
    }
</script>
</body>
</html>
